<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('jiami','Home\IndexController@jiami');
Route::get('index','Home\IndexController@index');
Route::get('index/login','Home\IndexController@login');
Route::post('index/dologin','Home\IndexController@doLogin');
Route::get('lists/{id}','Home\IndexController@lists');
Route::get('detail/{id}','Home\IndexController@detail');
Route::get('index/phoneregister','Home\IndexController@phoneRegister');
Route::post('home/sendMessage','Home\IndexController@sendMessage');
Route::post('home/doregister','Home\IndexController@doRegister');

//收藏功能
Route::post('collect','Home\IndexController@collect');



Route::group(['prefix'=>'admin','namespace'=>'Admin'],function (){
    Route::get('login','LoginController@login');
    //验证码
    Route::get('code','LoginController@code');
    //处理登录
    Route::post('doLogin','LoginController@doLogin');

    Route::get('jiami','LoginController@jiami');

});

//路由组验真登录

Route::get('noaccess','Admin\LoginController@noAccess');

Route::group(['prefix'=>'/admin','namespace'=>'Admin','middleware'=>['islogin','hasRole']],function(){
    //后台首页
    Route::get('index','LoginController@index');
    //后台欢迎页
    Route::get('welcome','LoginController@welcome');
    //退出登录
    Route::get('logout','LoginController@logout');
    //删除所有选中
    Route::get('user/del','UserController@delAll');
    //后台用户管理路由
    Route::resource('user','UserController');
    //用户角色
    Route::get('user/auth/{id}','UserController@Auth');
    Route::post('user/doauth','UserController@doAuth');
    //切换用户状态
    Route::post('user/changeStatus/','UserController@changeStatus');



    //角色路由
    Route::resource('role','RoleController');
    //角色授权路由
    Route::get('role/auth/{id}','RoleController@Auth');
    Route::post('role/doauth','RoleController@doAuth');
    Route::post('role/del','RoleController@delAll');

    //权限路由
    Route::resource('permission','PermissionController');

    //分类路由
    Route::resource('cate','CateController');
    Route::post('cate/changeOrder','CateController@changeOrder');


    //文件上传访问路由
    Route::resource('article','ArticleController');
    //文件上传路由
    Route::post('article/upload','ArticleController@upload');
    //将markdown语法转为html路由
    Route::post('article/pre_mk','ArticleController@pre_mk');
    //推荐位
    Route::post('article/recommend','ArticleController@recommend');
    //保存更改文章
    Route::post('article/changeContent/{id}','ArticleController@changeContent');


    //网站配置模块
    Route::get('config/putConfigs','ConfigController@putConfigs');
    Route::resource('config','ConfigController');
    Route::post('config/changeContent','ConfigController@changeContent');

});



